#include <stdio.h>
#include <stdlib.h>
#include "../Includes/Driver.h"
#include "../Includes/Messaging.h"
#include "../Includes/Window.h"
#include <fcntl.h>

/// <summary>
/// TODO
/// </summary>
WindowPtr CreateWindow(void) {
	WindowPtr win;
	if (!(win = (WindowPtr)malloc(sizeof(Window))))
		return NULL;
	return win;
}

/// <summary>
/// TODO
/// </summary>
int CreateWindowByMessage(MessagePtr msg) {

	if (msg == NULL)
		return -1;

	return 0;
}

/// <summary>
/// TODO
/// </summary>
MESSAGE_HANDLER(ShowWindow)
{
	WindowPtr win;
	if ((win = (WindowPtr)msg->param1) == NULL)
		return -1;

	return 0;
}

/// <summary>
/// TODO
/// </summary>
MESSAGE_HANDLER(HideWindow)
{
	WindowPtr win;
	if ((win = (WindowPtr)msg->param1) == NULL)
		return -1;

	return 0;
}

/// <summary>
/// TODO
/// </summary>
MESSAGE_HANDLER(MoveWindow)
{
	WindowPtr win;
	if ((win = (WindowPtr)msg->param1) == NULL)
		return -1;
	win->left   = (int)msg->param2;
	win->top    = (int)msg->param3;
	win->width  = (int)msg->param4;
	win->height = (int)msg->param5;
	msg->result = 100;
	return 0;
}

/// <summary>
/// TODO
/// </summary>
MESSAGE_HANDLER(DestroyWindow)
{
	WindowPtr win;
	if ((win = (WindowPtr)msg->param1) == NULL)
		return -1;
	return 0;
}
